package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.wx.catalog.CatalogVo;
import com.cskaoyan.service.wx.WxCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 查询商品分类信息
 * url:/wx/catalog/current?id=1005001
 *
 * @Author: zhang
 * @Date: 2022/11/22 20:09
 * @Since: jdk1.8
 */
@RestController
@RequestMapping("wx/catalog")
public class WxCatalogController {
    @Autowired
    WxCatalogService wxCatalogService;

    /**
     * 查询当前的商品类目信息
     *
     * @param id 类目id
     * @return BaseRespVo<CatalogVo>
     */
    @GetMapping("current")
    public BaseRespVo<CatalogVo> current(Integer id) {
        CatalogVo data = wxCatalogService.current(id);
        return BaseRespVo.ok(data);
    }

    /**
     * 查询所有的商品类目信息
     *
     * @return BaseRespVo<CatalogVo>
     */
    @GetMapping("index")
    public BaseRespVo<CatalogVo> index() {
        CatalogVo data = wxCatalogService.index();
        return BaseRespVo.ok(data);
    }
}
